package com.xnewtech.xplatform.swan.system.api;

import com.xnewtech.xplatform.swan.system.api.model.BaseUserInfo;
import com.xnewtech.xplatform.swan.system.api.model.UserInfo;
import com.xnewtech.xplatform.swan.system.api.model.WorkflowRoleInfo;
import com.xnewtech.xplatform.swan.system.api.model.req.UserByRoleReq;
import com.xnewtech.xplatform.swan.system.api.model.req.UserListReq;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * 登录相关的api
 *
 * @author xnew
 * @date 2020-10-12-上午10:04
 */
@RequestMapping("/baseSystem")
public interface BaseSystemApi {

    /**
     * 校验账号密码，获取用户
     *
     * @author xnew
     * @Date 2020-10-12 15:46
     */
    @RequestMapping(value = "/getUserByAccount", method = RequestMethod.POST)
    BaseUserInfo getUserByAccount(@RequestParam(value = "account") String account);

    /**
     * 获取用户名称通过账号id
     *
     * @author xnew
     * @Date 2020-10-12 12:51
     */
    @RequestMapping(value = "/getNameByAccountId", method = RequestMethod.POST)
    String getNameByAccountId(@RequestParam(value = "accountId") Long accountId);

    /**
     * 获取用户名称通过用户详情id
     *
     * @author xnew
     * @Date 2020-10-12 12:51
     */
    @RequestMapping(value = "/getNameByUserId", method = RequestMethod.POST)
    String getNameByUserId(@RequestParam(value = "userId") Long userId);

    /**
     * 获取角色列表
     *
     * @author xnew
     * @Date 2020-10-12 13:21
     */
    @RequestMapping(value = "/getRoleList", method = RequestMethod.POST)
    List<WorkflowRoleInfo> getRoleList();

    /**
     * 获取用户列表通过角色id
     *
     * @author xnew
     * @Date 2020-10-12 13:22
     */
    @RequestMapping(value = "/getUserListByRoleId", method = RequestMethod.POST)
    List<UserInfo> getUserListByRoleId(@RequestParam(value = "roleId") Long roleId);

    /**
     * 获取用户列表通过角色id(带分页)
     *
     * @author xnew
     * @Date 2020-10-12 13:22
     */
    @RequestMapping(value = "/getUsersByRoleIdByPage", method = RequestMethod.POST)
    Page<UserInfo> getUsersByRoleIdByPage(@RequestBody UserByRoleReq userByRoleReq);

    /**
     * 获取用户列表，通过用户id或角色id的集合
     *
     * @author xnew
     * @Date 2020-10-12 16:21
     */
    @RequestMapping(value = "/getUserListByUserIdsOrRoleIds", method = RequestMethod.POST)
    List<UserInfo> getUserListByUserIdsOrRoleIds(@RequestBody UserListReq userListReq);

    /**
     * 获取数据库名称通过租户编码
     *
     * @author xnew
     * @Date 2020-10-12 21:09
     */
    @RequestMapping(value = "/getDbNameByTenantCode", method = RequestMethod.POST)
    String getDbNameByTenantCode(@RequestBody String tenantCode);

}
